<!-- 项目浏览 -->
<template>
	<div class="t-wp" v-loading="state.loading">
		<el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
			<el-form :model="state.queryParams" ref="queryForm" :inline="true">
				<el-form-item label="项目名称">
					<el-input v-model="state.queryParams.aaa" placeholder="请输入"/>
				</el-form-item>
				<el-form-item label="负责人">
					<el-input v-model="state.queryParams.bbb" placeholder="请输入"/>
				</el-form-item>
				<el-form-item>
					<el-button-group>
						<el-button type="primary" icon="ele-Search" @click="handleQuery"> 查询 </el-button>
						<el-button icon="ele-Refresh" @click="resetQuery"> 重置 </el-button>
					</el-button-group>
				</el-form-item>
			</el-form>
		</el-card>
		<el-card class="full-table" shadow="hover" style="margin-top: 8px">
			<el-table :data="state.logData" style="width: 100%" border>
				<el-table-column type="index" label="序号" width="55" align="center" />
				<el-table-column prop="aa1" label="项目名称" align="center" show-overflow-tooltip />
				<el-table-column prop="aa2" label="采购方式" align="center" show-overflow-tooltip />
				<el-table-column prop="aa3" label="负责人" align="center" show-overflow-tooltip />
				<el-table-column prop="aa4" label="中标供应商" align="center" show-overflow-tooltip />
				<el-table-column prop="aa5" label="金额|万元" width="80" align="center" show-overflow-tooltip />
				<el-table-column label="操作" width="150" align="center" fixed="right" show-overflow-tooltip>
					<template #default="scope">
						<el-button icon="el-icon-search" size="small" text type="primary">查看</el-button>
					</template>
				</el-table-column>
			</el-table>
			<el-pagination
				v-model:currentPage="state.tableParams.page"
				v-model:page-size="state.tableParams.pageSize"
				:total="state.tableParams.total"
				:page-sizes="[10, 20, 50, 100]"
				small
				background
				@size-change="handleSizeChange"
				@current-change="handleCurrentChange"
				layout="total, sizes, prev, pager, next, jumper"
			/>
		</el-card>
	</div>
</template>

<script setup name="SupplierManage">
import { onMounted, reactive, ref } from 'vue';
import {useRouter, useRoute} from "vue-router";
import { ElMessage } from 'element-plus';

const router = useRouter();
const route = useRoute();

const PUBLIC_PATH = import.meta.env.VITE_PUBLIC_PATH;
const state = reactive({
	loading: false,
	queryParams: {
		aaa: '',
		bbb: '',
	},
	tableParams: {
		page: 1,
		pageSize: 20,
		total: 0,
	},
});

onMounted(async () => {
	handleQuery();
});

// 查询操作
const handleQuery = async () => {
	// if (state.queryParams.startTime == null) state.queryParams.startTime = undefined;
	// if (state.queryParams.endTime == null) state.queryParams.endTime = undefined;

	// state.loading = true;
	// let params = Object.assign(state.queryParams, state.tableParams);

	// var res = await chatPage(params);
	// state.logData = res.data.result?.items || [];
	// state.tableParams.total = res.data.result?.total;
	// state.loading = false;
};

// 重置操作
const resetQuery = () => {
	state.queryParams.aaa = '';
	state.queryParams.bbb = '';
	handleQuery();
};

// 改变页面容量
const handleSizeChange = (val) => {
	state.tableParams.pageSize = val;
	handleQuery();
};

// 改变页码序号
const handleCurrentChange = (val) => {
	state.tableParams.page = val;
	handleQuery();
};

// 显示数据源
const showResource = (row) => {
	resourceModalRef.value.open(row.datasource);
};

</script>

<style lang="scss" scoped>
.t-wp {
	
}
</style>
